package com.aaa.tomcat;

import java.io.IOException;

/**
 * @author ：Teacher陈
 * @date ：Created in 2021/1/20 10:48
 * @description：我自己的servlet
 * @modified By：
 * @version: 1
 */
public abstract class ServletAAA {
    /**
     * @create by: Teacher陈
     * @description: 处理get请求
     * @create time: 2021/1/20 10:51
     * @return
     */
    public abstract void doGet(RequestAAA req, ResponseAAA resp) ;
    /**
     * @create by: Teacher陈
     * @description: 处理post请求
     * @create time: 2021/1/20 10:51
     * @return
     */
    public abstract void  doPost(RequestAAA req, ResponseAAA resp);

    /**
     * @create by: Teacher陈
     * @description: 根据请求方式，去进入不同的处理方法
     * @create time: 2021/1/20 10:55
     * @param  req,  resp
     */
    public  void  service(RequestAAA req, ResponseAAA resp){
        if("GET".equalsIgnoreCase(req.getMethod())){
            doGet(req,resp);
        }else if("POST".equalsIgnoreCase(req.getMethod())){
            doPost(req,resp);
        }
    }
}
